# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Aaron Schaefer <aaron@elasticdog.com>

pkgname=duplicity
pkgver=1.2.2
pkgrel=2
pkgdesc='A utility for encrypted, bandwidth-efficient backups using the rsync algorithm'
arch=('loong64' 'x86_64')
url='https://duplicity.gitlab.io/'
license=('GPL')
depends=('gnupg' 'librsync' 'python-paramiko' 'python-fasteners' 'python-future')
makedepends=('python-setuptools-scm')
optdepends=('lftp: backend for ftp, ftps, fish'
            'ncftp: alternative backend for ftp'
            'python-boto: Amazon S3 and Google Cloud Storage backend'
            'python-dropbox: Dropbox backend'
            'python-gobject: GIO backend'
            'gvfs: GIO backend'
            'python-pydrive2: Google Drive backend'
            'python-requests-oauthlib: OneDrive backend'
            'rsync: rsync backend')
source=("$pkgname-$pkgver.tar.gz::https://gitlab.com/duplicity/duplicity/-/archive/rel.$pkgver/duplicity-rel.$pkgver.tar.gz")
sha512sums=('014a60a128bfefeca80777c566f0c0f2683c8f4c93e4337cb1317a877b67a531b58789bd0e1f42dbd544e12b113a8950f6d87828ef70c3a33eed9cf28ae5e48a')
b2sums=('569176197fd794eb8a25ed728966eabec08a7cd912f13dd0f4f9067b35c131f24298f962c4eb250766000705b99eb922db39db672bb0cb0d63dac03ab68909fe')

prepare() {
  cd "$pkgname-rel.$pkgver"

  # FS#76307 - fix version string
  sed -e "s/\$version/$pkgver/" -i "$pkgname/__init__.py"
}

package() {
  cd "$pkgname-rel.$pkgver"

  python setup.py install --root="$pkgdir" --optimize=1

  # move documentation to the correct directory
  cd "$pkgdir/usr/share/doc"
  mv "$pkgname-$pkgver" "$pkgname"
}
